<?php

use App\Http\Controllers\Web\JuheH5GameController;
use App\Http\Controllers\Web\PolicyController;
use App\Http\Controllers\Web\ProtocolController;
use App\Http\Controllers\Web\QrcodeJumpUrlController;
use App\Http\Controllers\Web\SpinWheelController;
use App\Http\Controllers\Web\SwitchPayController;
use App\Http\Controllers\Web\TestController;
use App\Http\Controllers\Web\WanJuheController;
use App\Http\Controllers\Web\WanSdkController;
use App\Http\Controllers\Web\WanSdkToApkController;
use App\Http\Controllers\Web\WanSdkTestController;
use Illuminate\Support\Facades\Route;

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

Route::any('/test/index', [TestController::class, 'index']);
Route::any('/test/adpage/{page_id}', [TestController::class, 'adpage']);

// 隐私政策
Route::any('/policy/index/{game_id}', [PolicyController::class, 'index']);

// 访问协议
Route::any('/protocol/{name}.html', [ProtocolController::class, 'index']);

// 用户点击购买
Route::any('switch_pay/click_pay', [SwitchPayController::class, 'clickPay']);

// 微信公众号支付，授权回调拿到code，进行换取access_token
Route::any('wxpay_jssdk_access_token', [SwitchPayController::class, 'wxpayJssdkAccessToken']);

// 微信H5支付
Route::any('wxpay_h5', [SwitchPayController::class, 'wxpayH5']);

// 支付宝H5支付
Route::any('alipay_h5', [SwitchPayController::class, 'alipayH5']);

// 前端支付回调
Route::any('switch_pay/callback/{pay_platform}/{game_channel_id}', [SwitchPayController::class, 'callback']);
Route::any('switch_pay/index/{trade_no}', [SwitchPayController::class, 'index']);
Route::any('switch_pay/info/{trade_no}', [SwitchPayController::class, 'info']);
Route::any('switch_pay/minigame', [SwitchPayController::class, 'minigamePay']);

// 二维码缓存跳转
Route::any('qrcode_jump_url/index', [QrcodeJumpUrlController::class, 'index']);

/*
|--------------------------------------------------------------------------
| 官包H5 ui
|--------------------------------------------------------------------------
*/
// 聚合H5登录页面
Route::any('/juheh5/game/index/{game_id}', [JuheH5GameController::class, 'index']);


/*
|--------------------------------------------------------------------------
| H5sdk
|--------------------------------------------------------------------------
*/
Route::any('/h5sdk/index/{game_id}/{game_channel_id?}', [WanSdkController::class, 'index']);
Route::any('/h5sdk/manifest/{game_id}/{game_channel_id}/manifest.json', [WanSdkController::class, 'manifest']);
Route::any('/h5sdk/oauth', [WanSdkController::class, 'oauthCb']);
Route::any('/h5sdk/click_wxpay_jssdk/{appid}', [WanSdkController::class, 'clickWxpayJssdk']);
Route::any('/h5sdk/wxpay_jssdk_access_token', [WanSdkController::class, 'wxpayJssdkAccessToken']);

Route::any('/h5_toapk/index/{game_id}/{game_channel_id?}', [WanSdkToApkController::class, 'index']);
Route::any('/h5_toapk/oauth', [WanSdkToApkController::class, 'oauthCb']);

// 临时ab面
Route::any('/h5sdk/abindex/{game_id}', [WanSdkController::class, 'abIndex']);

Route::any('/spin_wheel/index/{game_id}', [SpinWheelController::class, 'index']);
Route::any('/spin_wheel/oauth', [SpinWheelController::class, 'oauthCb']);
Route::any('/spin_wheel/lottery', [SpinWheelController::class, 'lottery']);
Route::any('/spin_wheel/lottery_log', [SpinWheelController::class, 'lotteryLog']);
Route::any('/spin_wheel/address_fill', [SpinWheelController::class, 'addressFill']);


Route::controller(App\Http\Controllers\Web\WxMiniprogramController::class)->group(function () {
    Route::any('wx/miniprogram/jump', 'jump');
});

Route::any('/h5sdk/game_test', [WanSdkTestController::class, 'gameTest']);
Route::any('/h5sdk/oatuth_test', [WanSdkTestController::class, 'oauthCbTest']);
Route::any('/h5sdk/click_wxpay_jssdk_test/{appid}', [WanSdkTestController::class, 'clickWxpayJssdk']);
Route::any('/h5sdk/pay_test', [WanSdkTestController::class, 'payTest']);

/*
|--------------------------------------------------------------------------
| H5聚合
|--------------------------------------------------------------------------
*/
Route::any('/wan_juhe/index/{game_id}/{game_channel_id?}', [WanJuheController::class, 'index']);


/*
|--------------------------------------------------------------------------
| 小程序相关
|--------------------------------------------------------------------------
*/
Route::controller(App\Http\Controllers\Web\MiniprogramToGame\GameFaqController::class)->group(function () {
    Route::any('mtg/gamefaq/article/{id}', 'article');
});
